package phoenix.web.test_suites.naughtyfever.critical;

import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import phoenix.core.base.TestSuiteBase;
import phoenix.core.data_models.UserProfileDataModel.AboutMe;
import phoenix.core.data_models.UserProfileDataModel.LookingFor;
import phoenix.core.data_models.UserProfileDataModel.ProfileDetails;
import phoenix.web.test_objects.BackendTests;
import phoenix.web.test_objects.FunnelTests;
import phoenix.web.test_objects.MyProfileTests;
import phoenix.web.test_objects.RegistrationTests;

/**
 * Test suite - My Profile tests
 */
public class MyProfileTS extends TestSuiteBase
{
	// Tests
	private final RegistrationTests registrationTests = new RegistrationTests(phoenix);
	private final BackendTests backendTests = new BackendTests(phoenix);
	private final FunnelTests funnelTests = new FunnelTests(phoenix);
	private final MyProfileTests myProfileTests = new MyProfileTests(phoenix);

	@DataProvider
	public Object[][] registrationDataMale()
	{
		return registrationTests.dataProviders.registrationDataMale();
	}

	@DataProvider
	public Object[][] funnelData()
	{
		return funnelTests.dataProviders.funnelData();
	}

	@DataProvider
	public Object[][] myProfileData()
	{
		return myProfileTests.dataProviders.myProfileData();
	}

	@Test(dataProvider = "registrationDataMale", groups = { "registration" }, priority = 1, enabled = true)
	public void registrationTest(String p_userGender, String p_userEmail, String p_userPassword, String p_userBirthDay, String p_userBirthMonth,
			String p_userBirthYear)
	{
		registrationTests.registrationTest(p_userGender, p_userEmail, p_userPassword, p_userBirthDay, p_userBirthMonth, p_userBirthYear);
	}

	@Test(dependsOnMethods = { "registrationTest" }, groups = { "registration" }, priority = 2, enabled = true)
	public void getUserDataTest()
	{
		backendTests.getUserDataTest(testUser().getEmail());
	}

	@Test(dependsOnMethods = { "getUserDataTest" }, groups = { "registration" }, priority = 3, enabled = true)
	public void confirmationTest()
	{
		funnelTests.confirmationTest();
	}

	@Test(dependsOnGroups = { "registration" }, dataProvider = "funnelData", priority = 4, enabled = true)
	public void funnelTest(String p_screenname, LookingFor p_looking, AboutMe p_about)
	{
		funnelTests.funnelTest(p_screenname, p_looking, p_about);
	}

	@Test(dependsOnGroups = { "registration" }, dataProvider = "myProfileData", priority = 5, enabled = true)
	public void myProfileSaveDataAfterFunnelTest(ProfileDetails p_details, LookingFor p_lookingFunnel, AboutMe p_about, LookingFor p_lookingMyProfile)
	{
		myProfileTests.saveDataAfterFunnelTest(p_lookingFunnel, p_about);
	}

	@Test(dependsOnGroups = { "registration" }, dataProvider = "myProfileData", priority = 6, groups = "updateInfo", enabled = true)
	public void myProfileUpdateMainInfoTest(ProfileDetails p_details, LookingFor p_lookingFunnel, AboutMe p_about, LookingFor p_lookingMyProfile)
	{
		myProfileTests.updateMainInfoTest(p_details);
	}

	@Test(dependsOnGroups = { "registration" }, dataProvider = "myProfileData", priority = 7, groups = "updateInfo", enabled = true)
	public void myProfileUpdatePersonalInfoTest(ProfileDetails p_details, LookingFor p_lookingFunnel, AboutMe p_about, LookingFor p_lookingMyProfile)
	{
		myProfileTests.updatePersonalInfoTest(p_details);
	}

	@Test(dependsOnGroups = { "registration" }, dataProvider = "myProfileData", priority = 8, groups = "updateInfo", enabled = true)
	public void myProfileUpdateLookingForInfoTest(ProfileDetails p_details, LookingFor p_lookingFunnel, AboutMe p_about, LookingFor p_lookingMyProfile)
	{
		myProfileTests.updateLookingForInfoTest(p_lookingMyProfile);
	}

	@Test(dependsOnGroups = { "registration" }, priority = 9, enabled = true)
	public void myProfileUploadPhotoTest()
	{
		myProfileTests.uploadPhotoTest();
	}

	@Test(dependsOnMethods = { "myProfileUploadPhotoTest" }, priority = 10, enabled = true)
	public void myProfileRemovePhotoTest()
	{
		myProfileTests.removePhotoTest();
	}

	@Test(dependsOnGroups = { "registration" }, priority = 11, enabled = true)
	public void makeUserPaid()
	{
		backendTests.makeUserPaid(testUser());
	}

	@Test(dependsOnMethods = { "makeUserPaid" }, dependsOnGroups = { "updateInfo" }, dataProvider = "myProfileData", priority = 12, enabled = true)
	public void myProfileViewDetailsOtherUserTest(ProfileDetails p_details, LookingFor p_lookingFunnel, AboutMe p_about, LookingFor p_lookingMyProfile)
	{
		myProfileTests.viewDetailsOtherUserTest(p_details, p_lookingMyProfile, p_about);
	}
}